package com.zerowidth.db.op;

import com.zerowidth.db.DBHelper;
import com.zerowidth.db.bean.GameSystemMessageBean;
import com.zerowidth.db.utils.IOUtils;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class GameSystemMessageDB {

    public static List<GameSystemMessageBean> getSystemMessage(String stat_id) {
        String sql = String.format("SELECT * FROM game_system_message WHERE status = 1");

        ResultSet rs = DBHelper.executeQuery(sql);

        List<GameSystemMessageBean> restList = new ArrayList<>();
        try {
            while (rs.next()) {
                GameSystemMessageBean bean = new GameSystemMessageBean();
                bean.message = rs.getString("message");

                restList.add(bean);
            }
        } catch (SQLException sqlException) {
            sqlException.printStackTrace();
        } finally {
            IOUtils.close(rs);
        }

        return restList;
    }

}